package com.lagou.sessionshare.web;

import com.lagou.sessionshare.Interceptor.LoginHandlerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @author: jie.zhao
 * @create: 2021/03/30 19:24
 */
@EnableWebMvc
@Configuration
public class WebConfig  extends WebMvcConfigurerAdapter {


    @Bean
    LoginHandlerInterceptor sessioninterceptor() {
        return new LoginHandlerInterceptor();
    }


    /**
     * 配置拦截器
     *
     * @param registry
     * @author yuqingquan
     */
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(sessioninterceptor());
    }
}
